<include file="public:header" />
<div class="container">
	<if condition="$user['id'] eq 7">
	<h4 class="webview-title">累计申述成功 {$success} 条 <small>{$timeLimit}</small></h4>
	</if>
	<hr />
	<form role="form" action="__ROOT__?g=api&m=sales&a=dispute" method="post">
		<div class="form-group">
			<label for="startTime">开始时间</label>
			<input name="startTime" type="text" value="{$startTime}" readonly class="form-control form_datetime" placeholder="请选择"> 
		</div>
		<div class="form-group">
			<label for="endTime">结束时间</label>
			<input name="endTime" type="text" value="{$endTime}" readonly class="form-control form_datetime" placeholder="请选择"> 
		</div>
		<button type="submit" class="btn btn-primary btn-block">搜索</button>
	</form>
	
	<p>&nbsp;</p>
		<div class="row">
			<div class="container">
				<volist name="list" id="v">
					<div class="col-xs-12 webview-border dispute-{$v.id}" >
						<p>&nbsp;</p>
						<div class="row">
							<div class="col-xs-4 text-right" ><strong>IMEI：</strong></div>
							<div class="col-xs-8" >{$v.imei}</div>
						</div>	
						<div class="row">	
							<div class="col-xs-4 text-right" ><strong>机型：</strong></div>
							<div class="col-xs-8" >{$v.model}</div>
						</div>	
						<div class="row">
							<div class="col-xs-4 text-right" ><strong>申诉时间：</strong></div>
							<div class="col-xs-8" >{:date('Y-m-d H:i:s', $v['createTime'])}</div>
						</div>
						<div class="row">	
							<div class="col-xs-4 text-right" ><strong>发起人：</strong></div>
							<div class="col-xs-8" >{$v.createRealName}</div>
						</div>	
						
						<div class="row">	
							<div class="col-xs-4 text-right" ><strong>处理进度：</strong></div>
							<div class="col-xs-8" >
								{$v.progress}
							</div>
						</div>	
					</div>
					<div class="btn-group btn-group-justified dispute-{$v.id}">
						<if condition="($v['status'] eq 0) AND ($v['createUserId'] eq $user['id'])">
							<a class="btn btn-default" href="javascript:void(0)" onclick="delVerify({$v.id});">取消申诉</a>
						</if>
						<a class="btn btn-default" href="__ROOT__?g=api&m=sales&a=disputeDetail&id={$v.id}">查看详情</a>
					</div>
					<p class="dispute-{$v.id}">&nbsp;</p>
				</volist>
			</div>
		</div>
	</div>
</div>


<div id="myModal" class="modal  fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<form id="formBox"  method="post" action="__ROOT__?g=api&m=sales&a=deleteDispute" >
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-body">
					<p>…</p>
				</div>
				<div class="modal-footer">
					<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
					<button type="submit" class="btn btn-primary">确定</button>
				</div>
			</div>
		</div>
	</form>
</div>





<script type="text/javascript">

	// 撤销申诉
	function delVerify(id){
		$("#myModal .modal-body").html('<p><strong>撤销后将删除本数据，您确定要撤销？</strong></p><input type="hidden"  name="id" value="'+id+'" />');
		$('#myModal').modal("show");
	}
	
	//绑定一个指定的表单
    $('#formBox').ajaxForm({ 
            //设置传输的数据类型
            dataType:  'json', 
            //请求成功后，调用的回调函数
            success:  back
    }); 

    function back(project){
        if(project.status === 200){
			$('.dispute-'+project.data.id).hide();
			$('#myModal').modal("hide");
        }else{
			$("#myModal .modal-body").html('<strong>'+project.msg+'</strong>');
        }
    }

    $(".form_datetime").datetimepicker({
		minView: "month", //选择日期后，不会再跳转去选择时分秒 
		format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式 
		language: 'zh-CN', //汉化 
		autoclose:true //选择日期后自动关闭 
	});
	

</script>
<include file="public:footer" />